<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org"
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro"
      xmlns:layout="http://www.w3.org/1999/xhtml"
      layout:decorator="inc/layout"
>
<head>
    <meta charset="UTF-8"/>
    <title>课程</title>
    <style>
        .mycode * {
            margin: 0;
            padding: 0;
            font-size: 16px;
        }

        .mycode blockquote {
            height: 30px;
            line-height: 30px;
            border-left: 8px solid #d0e5f2;
            text-indent: 6px;
            background: #f1f1f1;
            display: block;
            margin: 10px 0;
            font-size: 16px;

        }

        .mycode pre code {
            display: block;
            color: inherit;
        }

        .mycode code {
            color: #c7254e;
            font-size: 13px;
            line-height: 1.5;
            padding: 5px 8px;
            background-color: #f1f1f1;
            border-radius: 3px
        }

        .mycode p {
            margin: 10px 8px;
            line-height: 1.5;
            font-size: 16px
        }

        .mycode li {
            font-size: 15px;
            line-height: 16px;
            margin-left: 25px;
        }

        .mycode li p {
            font-size: 14px;
            margin-left: 2px;
            line-height: 14px
        }

        .true {
            color: #8f4fff;
        }


    </style>

    <script th:inline="javascript">

        var id = [[${showCourse.id}]];


        function addReview() {
            $.post(ctxPath + "addReview/" + id, {description: $("#description").val()}, function (data) {
                layer.alert(data);
                $("#description").val("");
            })

        }

        function daShang() {
            layer.open({
                type: 2,
                title: '打赏',
                shade: 0.8,
                area: ['520px', '290px'],
                content: ctxPath + 'img/dashang.jpg', //iframe的url

            })

        }
    </script>


</head>

<body>
<div class="container" layout:fragment="content">

    <div class="row">

        <div class="col-sm-3">
            <div class="panel panel-default">

                <div class="panel-heading " th:if="${father!=null}">
                    <i class="fa  fa-edit"></i>
                    <a th:href="@{'/show/'+${father.id}}" th:text="${father.name}"></a>
                </div>
                <div class="panel-heading " th:if="${father==null}">
                    <i class="fa  fa-edit"></i>
                    <a th:href="@{'/show/'+${showCourse.id}}" th:text="${showCourse.name}"></a>
                </div>

                <ul class="list-group">
                    <li class="list-group-item" th:each="c:${course}">
                        <a th:href="@{'/show/'+${c.id}+'/'+${c.pId}}"
                           th:attrappend="class=${c.id==showCourse.id}"
                           th:text="${c.name}">
                        </a></li>

                </ul>

                <div class="panel-footer text-center">
                    <a th:href="@{/}">返回主页</a>
                </div>
            </div>

            <div class="panel panel-default" th:if="${typesCourse.size()>1}">

                <div class="panel-heading " >
                    <i class="fa fa-tree"></i>相关推荐
                </div>
                <ul class="list-group">
                    <li class="list-group-item" th:each="c:${typesCourse}"
                        th:if="${c.id!=showCourse.id and c.id!=showCourse.PId}">
                        <a th:href="@{'/show/'+${c.id}}"
                           th:attrappend="class=${c.id==showCourse.id}">
                            <div th:text="${c.name}"></div>
                        </a>

                    </li>

                </ul>


                <div class="panel-footer text-center">
                    <a th:href="@{/}">返回主页</a>
                </div>
            </div>
            <div class="panel panel-default">

                <div class="panel-heading text-center">
                    评论
                </div>
                <div class="panel-body">

                    <textarea id="description" class="form-control" rows="3" name="description"></textarea>
                    <input type="button" value="提交" class="btn btn-primary btn-block" onclick="addReview()"/>


                </div>


            </div>


        </div>
        <div class="col-sm-9">
            <div class=" panel panel-default">
                <div class="panel-body">
                    <div>
                        <div th:text="${showCourse.name}" class="h3 text-center text-capitalize"></div>
                        <div class="btn btn-warning" onclick="daShang()"><i class="fa fa-rmb"
                                                                            style="margin-right: 5px"></i>我要打赏
                        </div>
                        <span style="display: inline-block;margin-left: 50px">作者：
                            <span th:if="${father!=null and father.author!=null}" th:text="${father.author.nickname}">

                            </span>
                            <span th:if="${father==null or father.author==null}">
                                管理员
                            </span>
                        </span>
                    </div>
                    <hr/>
                    <div class="mycode" th:utext="${showCourse.text}">
                    </div>
                </div>

            </div>
        </div>
    </div>

</div>
</body>
</html>